package io;

import game.TicTacToeBoard;

public class GUIInputOutput extends InputOutput{
	
	private int move = -1; 
	
	private Object waitObject = new Object(); 
	
	public int getMove(){
		if(move == -1){
			try{ 
				synchronized(waitObject){
					waitObject.wait(); 
				}
			} catch (InterruptedException e){
				System.out.println("Thread interrupted!"); 
			}
		}
		System.out.println("move " + move); 
		int lastMove = move; 
		move = -1; 
		System.out.println("lastMove" + lastMove); 
		System.out.println("other hashCode" + this.hashCode());
		return lastMove; 
	}
	
	public boolean getResponse(){
		return true; 
	}
	
	public boolean checkExit(){
		return false; 
	}
	
	public void showBoard(TicTacToeBoard b){
		
	}
	
	public String getFileLocation(){
		String locat = "/Users/MickKellogg/Documents/tictactoehighscores/UserActionLog.rtf"; 
		return locat; 
	}
	
	public String newHighScoreName(){
		return "Joe"; 
	}
	
	public void passMove(int move){	
		synchronized(waitObject){
			waitObject.notify(); 
		}
		this.move = move; 
		System.out.println("passMove move " + move);
		System.out.println("GUI hashcode " + this.hashCode()); 
	}
} 
